<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>登陆</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="cache-control" content="no-cache" />
		<meta http-equiv="pragma" content="no-cache" />
		<link rel="stylesheet" type="text/css" href="/js/easyui/themes/default/easyui.css">
		<link rel="stylesheet" type="text/css" href="/js/easyui/themes/icon.css">
		<script type="text/javascript" src="/js/easyui/jquery.min.js"></script>
		<script type="text/javascript" src="/js/easyui/jquery.easyui.min.js"></script>
		<script type="text/javascript" src="/js/easyui/locale/easyui-lang-zh_CN.js"></script>
		<script>
			$(function(){
				$('#dlg').dialog('close');
				$("#login_btn").click(function(){
					$('#login_form').form('submit',{
						url:"/login/doLogin",
						method:"post",
						success:function(response){
							
							response=JSON.parse(response);
							if(response.state==200){
								$('#roleSelect').combobox({    
									data:response.data,    
								    valueField:'roleCode',    
								    textField:'roleName',
								    panelHeight:'auto',
								    onSelect:function(record){
								    	$.post("/login/selectRole",{roleCode:record.roleCode},function(result){
								    	   	if(result.state==200){
								    	   		window.location.href="/html/system/system.html";
								    	   	}else{
								    	   		alert(result.msg);
								    	   	}
								    	});
								    }
								});
								$('#dlg').dialog('open');
							}else{
								alert(response.msg);
							}
						}
					});
				});
				
				$("#reset").click(function(){
					$('#login_form').form('clear');
				});
			});
			
		</script>
	</head>
	<body>
			<div style="position:absolute;left:400px;top:150px">
				<div class="easyui-panel" title="登陆" style="max-width:400px;padding:30px 60px;">
					
					<form id="login_form" class="easyui-form" method="post" data-options="novalidate:true">
						<div style="margin-bottom:20px">
							<input class="easyui-textbox" name="userCode" style="width:100%" data-options="label:'用户名:',required:true">
						</div>
						
						<div style="margin-bottom:20px">
							<input class="easyui-textbox" name="password" style="width:100%" data-options="label:'密码:',required:true">
						</div>
						
					</form>
					
					
					<div style="text-align:center;padding:5px 0">
						<a href="javascript:void(0)" class="easyui-linkbutton" id="login_btn" style="width:80px">登陆</a>
						<a href="javascript:void(0)" class="easyui-linkbutton" onclick="clearForm()" style="width:80px">清除</a>
					</div>
				</div>
			</div>
			
			<div id="dlg" class="easyui-dialog" title="选择角色" data-options="iconCls:'icon-save'" style="width:400px;height:200px;padding:10px">
				<select class="easyui-combobox"  id="roleSelect"  name ="roleSelect"  label="选择角色" style="width:100%">
				</select>
			</div>                                    
			
	</body>
</html>